package com.hitown.model;

import java.util.HashMap;
import java.util.List;

/**
 * @author Naven
 * @version 创建时间：2018年3月1日 下午4:08:58
 * 
 */
public class Layui extends HashMap<String, Object> {

	public static Layui data(Integer count, List<?> data) {
		Layui ly = new Layui();
		ly.put("code", 0);     
		ly.put("msg", "success");     
		ly.put("count", count);
		ly.put("data", data);  
		return ly;             
	}            
	
	public static Layui data(Object data){
		Layui ly = new Layui();
		ly.put("code", 0);     
		ly.put("msg", "success");     
		ly.put("data", data);  
		return ly; 
	}
	
	public static Layui data(String msg,Object data){
		Layui ly = new Layui();
		ly.put("code", 0);     
		ly.put("msg", msg);     
		ly.put("data", data);  
		return ly; 
	}

/**
 * 	该方法不建议使用
 * code推荐采用String格式
 */
	public static Layui data(int code,String msg,Object data){
		Layui ly = new Layui();
		ly.put("code", code);     
		ly.put("msg", msg);     
		ly.put("data", data);  
		return ly; 
	}
	public static Layui data(String code,String msg,Object data){
		Layui ly = new Layui();
		ly.put("code", code);     
		ly.put("msg", msg);     
		ly.put("data", data);  
		return ly; 
	}
	public static Layui error(){
		Layui ly = new Layui();
		ly.put("code", 205);     
		ly.put("msg", "error");     
		return ly;
	}
	
	public static Layui error(String msg){
		Layui ly = new Layui();
		ly.put("code", 205);     
		ly.put("msg", msg);     
		return ly;
	}
	/**
	 * 已不使用,code采用String格式 
	 */
	public static Layui error(Integer code,String msg){
		Layui ly = new Layui();
		ly.put("code", code);     
		ly.put("msg", msg);     
		return ly;
	}
	
	public static Layui error(String code,String msg){
		Layui ly = new Layui();
		ly.put("code", code);     
		ly.put("msg", msg);     
		return ly;
	}
	
	public static Layui success(){
		Layui ly = new Layui();
		ly.put("code", 0);     
		ly.put("msg", "success");     
		return ly;
	}
	public static Layui success(String msg){
		Layui ly = new Layui();
		ly.put("code", 0);     
		ly.put("msg", msg);     
		return ly;
	}
/*	public static Layui success(Integer code,String msg){
		Layui ly = new Layui();
		ly.put("code", code);     
		ly.put("msg", msg);     
		return ly;
	}*/
	
	public static Layui success(String code,String msg){
		Layui ly = new Layui();
		ly.put("code", code);     
		ly.put("msg", msg);     
		return ly;
	}
	/**
	 * 成功：{"code":0，"msg":"推送数据成功！"}
	 * 失败：{"code":201，"msg":"对应参数错误！"}
	 * {"code":203，"msg":"接口调用异常！"}
	 * {"code":204，"msg":"图片保存异常！"}
	 * {"code":205，"msg":"服务器异常！"}
	 * 
	 */
}                              
